import type { AtomConfig, AtomType } from "../atom/atom"; export type ChangeFlagAtomType = AtomType & { /** * Trigger a reactivity update. * * - Called with no argument: sets the value to `Math.random()`, guaranteeing * a new value every call and forcing all subscribers / effects / views to * re-run. * - Called with a number: sets the value to that number. Useful when you * want a meaningful version counter or a specific sentinel value. * * @example * flag.change(); // random — always triggers * flag.change(n + 1); // explicit increment */ change(value?: number): void; /** Discriminator tag — always `"changeFlagAtom"`. */ readonly name: "changeFlagAtom"; }; /** * changeFlagAtom — a reactive number atom whose sole purpose is to force * re-renders, effect re-runs, and subscription callbacks. * * The stored number is intentionally meaningless by default — only the fact * that it changed matters. Call `change()` to trigger, or pass a value if * you want a meaningful version counter. * * Pairs well with `disappear` to bring back a disappeared element: * * @example * const flag = changeFlagAtom(); * * // Re-render the element (and restart the disappear timer) each time flag changes * return () => html` * ${flag()} // read flag so the template re-runs when it changes *
I vanish in 3 s
* * `; * * @example * // Explicit version counter * const version = changeFlagAtom(0); * version.change(version() + 1); * * @example * // Pair with effect * const refresh = changeFlagAtom(); * effect(() => { * refresh(); // subscribe * fetchData(); * }); * // later: * refresh.change(); // re-triggers the effect */ export declare function changeFlagAtom(initial?: number, config?: AtomConfig): ChangeFlagAtomType; //# sourceMappingURL=changeFlagAtom.d.ts.map